<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>登录</title>
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <link rel="stylesheet" href="../static/css/regist.css">
</head>
<body>
<h1>注册</h1>
<div class="container">

    <div class="form-group">
        <label>用户名</label>
        <input type="text" id="username" placeholder="请输入用户名">
    </div>
    <div class="form-group">
        <label>密码</label>
        <input type="password" id="password" placeholder="请输入密码">
    </div>
    <div style="text-align: center;">
        <button id="regist">注册</button>
        <br><br>
        <button id="login">已有账号，前往登陆</button>
    </div>

</div>

<script>
    $("#login").click(function () {
        window.open('/login', '_self')
    })


    $("#regist").click(function () {
        $.ajax({
            url: "/regist",
            type: "POST",
            dataType: 'json',
            data: {
                User: $("#username").val(),
                Password: $("#password").val()
            },
            success: function (result) {
                alert(result)
                console.log(result)

            },
            error: function () {
                console.log('shibai')

            },
        });
    })
</script>
</body>
</html>